package com.daguchuangyi.erp_android.util;

import android.text.TextUtils;

/**
 * Created by lijianjian on 2018/3/3.
 */

public class IPCheckUtil {
    private static String sExp =
            "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\."
                    + "(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$";

    public static boolean isValidIp(String ip) {
        if (TextUtils.isEmpty(ip)) {
            return false;
        } else {
            return ip.matches(sExp);
        }
    }
}
